package com.zhoust.fastdome.annnotation;

import org.reflections.Reflections;

import java.util.Set;

/**
 * @author zhoust
 * @Date 2021/9/25 23:30
 * @Desc <TODO DESC>
 */
public class GetAnnotation {
    public static void getAnnotation() {
        // 要扫描的包
        String packageName = "com.zhoust.fastdome.business.controller";
        Reflections f = new Reflections(packageName);
        // 获取扫描到的标记注解的集合
        Set<Class<?>> set = f.getTypesAnnotatedWith(LogAutoRecord.class);
        for (Class<?> c : set) {
            // 循环获取标记的注解
            LogAutoRecord annotation = c.getAnnotation(LogAutoRecord.class);
            // 打印注解中的内容
            System.out.println(annotation.methodDesc());
        }
    }
}
